[broadway] Wire up the delete event
authorAlexander Larsson <alexl@redhat.com>
Wed, 6 Apr 2011 20:13:18 +0000 (22:13 +0200)
committerAlexander Larsson <alexl@redhat.com>
Thu, 7 Apr 2011 08:03:17 +0000 (10:03 +0200)
gdk/broadway/broadway.js
gdk/broadway/gdkdisplay-broadway.c
gdk/broadway/gdkdisplay-broadway.h
gdk/broadway/gdkeventsource.c

index 0ce4b1111e3cb36e6ad95bcb2543e9cb7f8d0272..eba484ce1f3c63fdc63e56fc99ae54c61c369698 100644 (file)
@@ -275,15 +275,28 @@ function updateBrowserWindowGeometry(win) {
            }
        }
     }
+}
+
+function browserWindowClosed(win) {
+    var surface = win.surface;
 
+    sendInput ("W", [surface.id]);
+    for (id in surfaces) {
+       if (surfaces[id].transientToplevel != null && surfaces[id].transientToplevel == surface) {
+           var childSurface = surfaces[id];
+           sendInput ("W", [childSurface.id]);
+       }
+    }
 }
 
+
 function registerWindow(win)
 {
     toplevelWindows.push(win);
     win.onresize = function(ev) { updateBrowserWindowGeometry(ev.target); };
     if (!windowGeometryTimeout)
        windowGeometryTimeout = setInterval(function () { toplevelWindows.forEach(updateBrowserWindowGeometry); }, 2000);
+    win.onunload = function(ev) { browserWindowClosed(ev.target.defaultView); };
 }
 
 function unregisterWindow(win)
index 3ed9a79a4251c2608669093a964c91119fe3c81b..c781cf5cebf208bf292df1d20976f1df25ca60ca 100644 (file)
@@ -258,7 +258,10 @@ parse_input_message (BroadwayInput *input, const char *message)
     msg.configure_notify.width = strtol (p, &p, 10);
     p++; /* Skip , */
     msg.configure_notify.height = strtol (p, &p, 10);
-    p++; /* Skip , */
+    break;
+
+  case 'W':
+    msg.delete_notify.id = strtol(p, &p, 10);
     break;
 
   default:
index 3e9be851ca22ea759dd651d8af4ffc24c1219fd8..76d681015f4e91605aef69ce6c4860cb9e9ad608 100644 (file)
@@ -96,6 +96,11 @@ typedef struct {
   int height;
 } BroadwayInputConfigureNotify;
 
+typedef struct {
+  BroadwayInputBaseMsg base;
+  int id;
+} BroadwayInputDeleteNotify;
+
 typedef union {
   BroadwayInputBaseMsg base;
   BroadwayInputPointerMsg pointer;
@@ -105,6 +110,7 @@ typedef union {
   BroadwayInputKeyMsg key;
   BroadwayInputGrabReply grab_reply;
   BroadwayInputConfigureNotify configure_notify;
+  BroadwayInputDeleteNotify delete_notify;
 } BroadwayInputMsg;
 
 struct _GdkBroadwayDisplay
index a6e47c97ac466b021db4bc2d0692c411b84a7580..db870ac7a20de13a967c0152fc5e20aa7a9db9d0 100644 (file)
@@ -294,6 +294,18 @@ _gdk_broadway_events_got_input (GdkDisplay *display,
       }
     break;
 
+  case 'W':
+    window = g_hash_table_lookup (display_broadway->id_ht, GINT_TO_POINTER (message->delete_notify.id));
+    if (window)
+      {
+       event = gdk_event_new (GDK_DELETE);
+       event->any.window = g_object_ref (window);
+
+       node = _gdk_event_queue_append (display, event);
+       _gdk_windowing_got_event (display, node, event, message->base.serial);
+      }
+    break;
+
   default:
     g_printerr ("Unknown input command %c\n", message->base.type);
     break;